{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 集成开发环境"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "python_base = {\n",
    "    \"IDE\":{\n",
    "        \"IDLE\":[\"操作/意义 90/90\"],\n",
    "        \"Jupyter\":[\"80/90\"],\n",
    "        \"Pycharm\":[\"80/80\"],\n",
    "        \"sublime text\":[\"60/60\"]\n",
    "        #操作内容：软件安装，破解使用，代码保存，解决报错问题，软件快捷键，书写效率，文件保存格式...\n",
    "        #意义：软件的优缺点？如何快速查错？对软件的理解？\n",
    "        }\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 基础概念"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "    \"base_knowledge\":{\n",
    "        \"UTF8编码\":[\"80/80\"],\n",
    "        \"注释\": [\"100/100\"],\n",
    "        \"行与缩进\": [\"100/100\"],\n",
    "        \"等待用户输入\": [\"100/100\"],\n",
    "        \"Print 输出\": [\"100/100\"],\n",
    "        \"import 与 from...import\": [\"80/100\"],\n",
    "        #python的基础语法\n",
    "        #如何？——知道但是没有理解细节\n",
    "        #import的具体方法\n",
    "        #比如说PEP8的规范要求和书写\n",
    "    }"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 数据类型"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "    \"base_type\":{\n",
    "        \"Tuple（元组）\": [\"90/100\"],\n",
    "        \"Number（数字）\": [\"90/100\"],\n",
    "        \"String（字符串）\": [\"90/90\"],\n",
    "        \"List（列表）\": [\"80/80\"],\n",
    "        \"Set（集合）\": [\"80/80\"],\n",
    "        \"Dictionary（字典）\": [\"80/80\"],\n",
    "        #对于列表，集合和字典还是不够到位\n",
    "        #列表的创建、访问、更新、删除、嵌套\n",
    "        #集合的添加、移除、计算、判断\n",
    "        #字典的删除、访问、修改\n",
    "        #核心问题——三者到底有什么特征？我们什么时候应该该用哪个类型来进行？\n",
    "        #区别三者之间的使用方法，应用于什么场景，掌握还需要大量的练习\n",
    "    }"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 课程所学知识 "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## if语句"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "    \"if语句\":{\n",
    "            [\"90/100\"]\n",
    "            # if elif else的用法\n",
    "            #嵌套判断\n",
    "            #猜数字游戏\n",
    "        }"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## for循环以及range内置函数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "    \"for循环以及range内置函数\":{\n",
    "            [\"100/100\"]\n",
    "            #迭代循环数字变量\n",
    "            #字符串变量\n",
    "            #迭代指定次数\n",
    "            #用for循环求解1+2+3..+100的总和\n",
    "        }"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## random模块"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "    \"random模块\": {\n",
    "        [\"100/100\"]\n",
    "        # random.randint(a,b)的意义用法\n",
    "    }"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 第一次作业"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "    \"第一次作业\": {\n",
    "        [\"100/100\"]\n",
    "        # datetime模块和if语句的课程提醒表 √（实现上课提醒）\n",
    "        # random模块和if语句猜猜小游戏 √ （随机祝福语）\n",
    "        # for和range函数的乘法口诀表\n",
    "    }"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 列表"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "    \"列表\": {\n",
    "        [\"80/80\"]\n",
    "        # list()列表的创建方法\n",
    "        # append（）末尾添加\n",
    "        # extend（）添加可迭代函数\n",
    "        # insert（）插入函数\n",
    "        # pop（）移除最后一个元素并且返回值\n",
    "        # 合并列表\n",
    "        # range（）创建整数列表\n",
    "        #列表元素取值\n",
    "    }"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 元组"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "    \"元组\":{\n",
    "        [\"100/100\"]\n",
    "        # index()找出索引\n",
    "        # 索引值从0开始！！！！\n",
    "        # count()次数搜索\n",
    "    }"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## white循环"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "    \"white循环\": {\n",
    "        [\"100/100\"]\n",
    "        # white ture\n",
    "        # if a=xx 加入循环结束条件\n",
    "        # break 跳出循环\n",
    "    }"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 第二次作业"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "    \"第二次作业\": {\n",
    "        [\"85/100\"]\n",
    "        # 使用while和列表写一个猜数字游戏 √\n",
    "        # 输入字符串统计元素出现次数 √\n",
    "    }"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import random\n",
    "suzi = random.randint(1,100)\n",
    "count = 0\n",
    "while count<3:\n",
    "    nums = input(\"猜你的数字\")\n",
    "    guess = int(nums)\n",
    "    if guess == suzi:\n",
    "        print(\"你猜对了！\")\n",
    "        print(suzi)\n",
    "    elif guess < suzi:\n",
    "        print(\"猜小了~\")\n",
    "    else:\n",
    "        print(\"猜大了~\")\n",
    "count +=1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "found = {\n",
    "    \"zimu\":0,\n",
    "    \"kongge\":0,\n",
    "    \"suzi\":0,\n",
    "    \"qita\":0,\n",
    "}\n",
    "shuru = input(\"请输入一个字母字符串:\")\n",
    "for i in shuru:\n",
    "    if i>=\"a\" <=\"z\" or i>=\"A\" <=\"Z\":\n",
    "        found['zimu']+=1\n",
    "    elif i == ' ' :\n",
    "        found['kongge']+=1\n",
    "    elif i in '0123456789' :\n",
    "        found['suzi']+=1\n",
    "    else:\n",
    "        found['qita']+=1\n",
    "\n",
    "for item in found:\n",
    "    print(item,\"is found\",found[item])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 购物车项目"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "    \"购物车项目\": {\n",
    "        [\"70/70\"]\n",
    "        # 1、运行程序后，让用户输入支付宝余额，然后打印我们的商品列表给用户。list知识\n",
    "        # 2、让用户输入商品编号进行商品的购买。input知识\n",
    "        # 3、用户选择商品后，检查用户的余额是否够，若够则直接扣款，不够则提醒用户。if语句\n",
    "        # 4、用户可以随时退出购买，推出时打印用户已购买的商品和支付宝余额。打印知识\n",
    "        \n",
    "    }"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "product_list = [\n",
    "    (\"华为P30\",4000),\n",
    "    (\"mac pro\",16000),\n",
    "    (\"milk tea\",20),\n",
    "    (\"crabs\",88),\n",
    "    (\"bike\",400),\n",
    "    (\"watch\",40000),\n",
    "    (\"book\",40),\n",
    "    (\"python\",128),\n",
    "]\n",
    "shopping_car = []\n",
    "pay = input(\"请输入支付宝数字余额\")\n",
    "if pay.isdigit():\n",
    "    pay = int(pay)\n",
    "    while True:\n",
    "        for item in product_list:\n",
    "            print(product_list.index(item),item)\n",
    "        choice = input(\"请选择您要购买的商品序号：\")\n",
    "        if  choice.isdigit():\n",
    "            choice = int(choice)\n",
    "            if choice >=0 and choice <8:\n",
    "                if pay >= product_list[choice][1]:\n",
    "                    pay = pay - product_list[choice][1]\n",
    "                    shopping_car.append(product_list[choice])\n",
    "                    print(\"你购买了%s，支付宝余额是%s:\"%(product_list[choice][0],pay))\n",
    "                else:\n",
    "                    print(\"你的支付宝余额不足，请重新选择\")\n",
    "            else:\n",
    "                print(\"不存在该商品\")\n",
    "        elif choice ==\"q\":\n",
    "            print(\"购物车清单\")\n",
    "            for item in shopping_car:\n",
    "                print(item)\n",
    "            print(\"你的支付宝余额%S:\"% pay)\n",
    "            break\n",
    "        else:\n",
    "            print(\"按q退出程序\")\n",
    "    else:\n",
    "        print(\"请输入数字金额\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 字典"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "    \"字典\": {\n",
    "        [\"80/80\"]\n",
    "        # 字典创建 key-value key是唯一的\n",
    "        # 字典访问 字典名称[key]\n",
    "        # 字典增加 赋予新的key值\n",
    "        # 字典删除 del 删除值 clear 清空 popitem 随机删除\n",
    "        # len（）计算字典个数\n",
    "        # str（）输出字符串打印\n",
    "        # 字典键入需要清晰明了！\n",
    "        # 字典嵌套 访问复杂的数据\n",
    "        # 字典的频度计数器 found[]+=1\n",
    "        # 使用for来循环字典\n",
    "        # 字典in和not in 检查键是否存在，若不存在则使用if not in添加键\n",
    "        # setdefault（）完成 if not in 的工作\n",
    "    }"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 字典案例"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "    \"字典案例\": {\n",
    "        [\"90/90\"]\n",
    "        # 使用频度计算器来计算aeiou出现的次数\n",
    "        # 统计字符串出现的次数\n",
    "        # 投票系统\n",
    "    }"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "student={'小红':0,'小黄':0,'小绿':0,'小白':0}\n",
    "count=0\n",
    "while count<5:\n",
    "    name=input(\"请输入你想投票的名字\")\n",
    "    if name=='小红':\n",
    "       student['小红']+=1\n",
    "    elif name=='小绿':\n",
    "       student['小绿']+=1\n",
    "    elif name=='小黄':\n",
    "       student['小黄']+=1\n",
    "    else:\n",
    "       student['小白']+=1\n",
    "    count+=1\n",
    "print(student)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 集合"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "    \"集合\": {\n",
    "        [\"80/80\"]\n",
    "        # 集合不允许有重复，使用大括号，绝对只有逗号\n",
    "        # set（）创建集合\n",
    "        # sorted和list（）将集合转化为有序列表\n",
    "        # union（）合并列表\n",
    "        # defference（）报告不同元素\n",
    "        # intersection（）报告共有元素\n",
    "    }"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 函数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "    \"函数\": {\n",
    "        [\"70/80\"]\n",
    "        # 函数的关键词def和return/可接受参数数据/包含注释文件\n",
    "        # 打包函数和调用函数\n",
    "        # PEP8函数格式\n",
    "        # 形参和实参 形参是虚拟的，实参是占用空间的，所以函数只有在被调用时才会报错\n",
    "        # 形参和实参的顺序问题\n",
    "        # 让实参成为可选项，让有需要的用户调用\n",
    "        # 函数可以返回多个值\n",
    "        # *args，传入多个参数，转化成元组。\n",
    "        # 参数**kwargs，编写一个函数，结合空列表与空字典制作一个字典的存储器，函数调用部分只是负责输入。\n",
    "    }"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 模块"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "        \"模块\": {\n",
    "            [\"80/80\"]\n",
    "            # import 模块\n",
    "            # 用 as来代替长名称的模块\n",
    "            # from 模块 import 导入我们需要的函数\n",
    "            # 使用*来导入模块中所有的函数\n",
    "        }"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.3"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
